Skip to content

fix: surface mapStateToProps errors in connect - #2311

Closed
louzhedong wants to merge 1 commit into
reduxjs:masterfrom
louzhedong:fix/connect-mapstate-error-boundary
Closed

louzhedong wants to merge 1 commit into
reduxjs:masterfrom
louzhedong:fix/connect-mapstate-error-boundary

Conversation

@louzhedong

@louzhedong louzhedong commented Jun 7, 2026 •

Copy link
Copy Markdown

This makes connect rethrow subscription callback errors during render so mapStateToProps failures can reach an error boundary instead of being swallowed.

Validation:

  • ='C:\Users\Administrator\AppData\Local\npm-cache_npx\ebaba8b9e55fd0a9\node_modules\node\bin\node.exe'; & 'C:\Program Files\nodejs\node_modules\corepack\dist\yarn.js' vitest test/components/connect.spec.tsx --run

@codesandbox-ci

codesandbox-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@aryaemami59 aryaemami59 changed the title fix: surface mapStateToProps errors in connect fix: surface mapStateToProps errors in connect Jun 7, 2026
@louzhedong

Copy link
Copy Markdown
Author

Quick follow-up in case this is easier to review now than the other connect PR:

This change is intentionally narrow. It only re-surfaces mapStateToProps subscription errors during render so existing error boundaries can catch them, without changing the successful update path.

If you'd prefer this handled in a different layer of connect, or want the regression coverage trimmed to a smaller repro, I'm happy to adjust.

@markerikson

Copy link
Copy Markdown
Contributor

#2306 already logs these errors in development, and this approach rethrows the saved error even after a later store update or new props would let mapStateToProps succeed. That breaks the existing "throws once, then recovers" test. We're also trying to keep connect behavior changes to a minimum right now. Given that, I'm going to go ahead and close this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants